var controllersModule = angular.module('app.controllers');

/**
 * @ngInject
 */
function addEmpModal($scope, $uibModalInstance, empModel) {
    $scope.empModel = empModel;

    $scope.emailRegex = /^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i;
    $scope.nameRegex = /^(?=.{2,20}$)[a-zA-Z0-9\s_]+$/;

    $scope.ok = function () {
        $uibModalInstance.close($scope.empModel);
    };

    $scope.cancel = function () {
        $uibModalInstance.dismiss('cancel');
    };
}

controllersModule.controller('addEmpModal', addEmpModal);
